package com.study.cloud;

import cn.hutool.core.bean.BeanUtil;
import com.study.cloud.dto.OrderDTO;
import org.junit.Test;

import java.util.Random;
import java.util.function.BiConsumer;

public class Ta {

    static ThreadLocal<User> tl = new ThreadLocal<>();

    public static void main(String[] args) {


    }


    @Test
    public void testB(){
//
//        int[][] grade = {{1,2,3},{13,43}};
//        System.out.println(grade.length);

        OrderDTO orderDTO = new OrderDTO();
        orderDTO.setOrderId("1000");
        orderDTO.setOrderInfo("zhangsan");
        BeanUtil.beanToMap(orderDTO).forEach(new BiConsumer<String, Object>() {
            @Override
            public void accept(String s, Object o) {
                System.out.println(s+"===="+o);
            }
        });

    }



    @Test
    public void testa(){

        int[] ints = new int[10];

        for (int i = 0; i < 10; i++) {
            ints[i] = new Random().nextInt(10000);
        }

        for (int i = 0; i < ints.length; i++) {
            System.out.println(ints[i]);
        }

        for (int i = 0; i < ints.length; i++) {
            for (int j = i; j < ints.length; j++) {
                if(ints[i] > ints[j]){
                    int a = ints[i];

                    ints[i] = ints[j];
                    ints[j] = a;
                }
            }
        }

        System.out.println("=================");

        for (int i = 0; i < ints.length; i++) {
            System.out.println(ints[i]);
        }




    }




    static class User{

        private Integer id;
        private String name;

        public Integer getId() {
            return id;
        }

        public void setId(Integer id) {
            this.id = id;
        }

        public String getName() {
            return name;
        }

        public void setName(String name) {
            this.name = name;
        }

        @Override
        public String toString() {
            return "User{" +
                    "id=" + id +
                    ", name='" + name + '\'' +
                    '}';
        }
    }
}
